﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Zeus.Concurrency.ZThread
{
    public class ThreadScheduler
    {
        public static void StartThreads(int count, ParameterizedThreadStart threadWork, bool isSync = false)
        {
            Thread dedicatedThread;
            for (int i = 1; i <= count; i++)
            {
                dedicatedThread = new Thread(threadWork);
                dedicatedThread.Start(i);

                if (isSync)
                {
                    dedicatedThread.Join();  // Wait for thread to terminate
                }
            }
        }
    }
}
